/*
 * indicator.h
 *
 *  Created on: 16.07.2012
 *      Author: Roma Jam
 */

#ifndef INDICATOR_H_
#define INDICATOR_H_

#define INDICATOR_GPIO      GPIOB
#define INDICATOR_CLK       RCC_APB2Periph_GPIOB

#define PIN_UP              GPIO_Pin_0
#define PIN_UP_LEFT         GPIO_Pin_1
#define PIN_UP_RIGHT        GPIO_Pin_2
#define PIN_MIDDLE          GPIO_Pin_3
#define PIN_DN_LEFT         GPIO_Pin_4
#define PIN_DN_RIGHT        GPIO_Pin_5
#define PIN_DN              GPIO_Pin_6
#define PIN_DOT             GPIO_Pin_7

#define PIN_FIRST_SYMBOL    GPIO_Pin_8
#define PIN_SECOND_SYMBOL   GPIO_Pin_9


class Indicator_t {
private:
    uint32_t DelayTime;
    void Light_Digit(uint8_t ADigit);
    void Row1() {GPIO_SetBits(INDICATOR_GPIO, PIN_FIRST_SYMBOL); GPIO_ResetBits(INDICATOR_GPIO, PIN_SECOND_SYMBOL); }
    void Row2() {GPIO_SetBits(INDICATOR_GPIO, PIN_SECOND_SYMBOL); GPIO_ResetBits(INDICATOR_GPIO, PIN_FIRST_SYMBOL); }
public:
    void Init(void);
    void Dynamic_Indicate(uint8_t ADigit, bool ShowPoint);
};

extern Indicator_t Indicator;
#endif /* INDICATOR_H_ */
